<template>
    <div >
      <van-from >
          <van-field
            v-model="fee.water"
            name="剩余水量"
            label="剩余水量(单位:吨/2元)"
            placeholder="剩余水量"
          />
          <van-field
            v-model="fee.xiaoqu"
            name="小区"
            label="小区"
            placeholder="小区"
          />
          <van-field
            v-model="fee.loudong" 
            name="楼号"
            label="楼号"
            placeholder="楼号"
          />
          <van-field
            v-model="fee.danyuan"
            name="单元号"
            label="单元号"
            placeholder="单元号"
          />
          <van-field
            v-model="fee.fangjian"
            name="门牌号"
            label="门牌号"
            placeholder="门牌号"
          />
           <van-field
            v-model="fee.username"
            name="业主姓名"
            label="业主姓名"
            placeholder="业主姓名"
          />
          <van-field
            v-model="fee.money"
            name="缴费金额"
            label="缴费金额"
            placeholder="请输入缴费金额"
          />

          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit" @click="water">提交订单</van-button>
          </div> 
      </van-from>
         
      
      <!-- <div> -->
        <!-- <van-form @submit="onSubmit">
        <van-field
        readonly
        clickable
        name="picker"
        :value="value"
        label="小区"
        placeholder="点击选择小区"
        @click="showPicker = true"
        />
        <van-popup v-model="showPicker" position="bottom">
        <van-picker
            show-toolbar
            :columns="columns"
            @confirm="onConfirm"
            @cancel="showPicker = false"
        />
        </van-popup>
      
          <van-field
          readonly
            clickable
            name="building"
            :value="value1"
            label="楼号"
            placeholder="点击选择楼号"
            @click="showPicker1 = true"
            />
            <van-popup v-model="showPicker1" position="bottom">
            <van-picker
                show-toolbar
               :columns="columns1" 
                @confirm="onConfirm1"
                @cancel="showBuilding = false"
            />
        </van-popup> 

      
         <van-field
          readonly
            clickable
            name="unit"
            :value="value2"
            label="单元"
            placeholder="点击选择单元"
            @click="showPicker2 = true"
            />
            <van-popup v-model="showPicker2" position="bottom">
            <van-picker
                show-toolbar
               :columns="columns2" 
                @confirm="onConfirm2"
                @cancel="showUnit = false"
            />
        </van-popup>  -->
<!--      
        <van-field
            v-model="username"
            name="门牌号"
            label="门牌号"
            placeholder="请填写门牌号"
            :rules="[{ required: true, message: '请填写门牌号' }]"
          />

          <van-field
            v-model="price"
            name="缴费金额"
            label="缴费金额"
            placeholder="请输入缴费金额"
            :rules="[{ required: true, message: '请输入缴费金额' }]"
          />

          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">提交</van-button>
          </div> 
      </van-form>

      </div> -->
      
    </div>
</template>
<script>
export default {
  data() {
    return {
      // value: '',
      // value1: '',
      // value2: '',
      // columns:['南窑国际', '万科花园', '忆江南', '双水磨', '四季长安'],
      // columns1:['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15'],
      // columns2:['1','2','3','4','5'],
      // showPicker: false,
      // showPicker1: false,
      // showPicker2:false,
      // username:'',
      // price:'',
      fee:{
        hid:'',
        xiaoqu:'',
       loudong:'',
       danyuan:'',
       fangjian:'',
       shenfen:'',
       uid:'',
        water:'',
        dian:null,
        car:null,
       username:'',
       money:''
  
       }
      //  feeLists:[],
    };
  },
  methods: {
     water() {
       //alert("khskhlkskjs")
            this.$axios.post("addOrder",this.fee).then(res=>{
              if(res.data.code==1){
                alert(res.data.info);
                 this.$axios.post("fee/updateWaterMoney",this.fee).then(resp=>{
                    if(res.data.code==1){
                      alert(resp.data.info);
                      this.$router.push("/pay")
                    }
                 })
              }
            })
    },

    // onSubmit(values){
    //   this.$axios.get("addOrder").then(res=>{
    //     if(res.data.code==1){
    //       alert(res.data.info);
    //       this.$axios.get("update?money="+100).then(res=>{

    //       })
    //     }
    //   })
    // },
   
    },

  created(){
      this.$axios.get("fee/findById").then(res=>{
        if(res.data.code==1){
          this.fee=res.data.data;
        }
      })

    // onSubmit(values) {
    //   console.log('submit', values);
    // },
    // onConfirm(value) {
    //   //  console.log(value)
    //   this.value = value;
    //   this.showPicker = false;
    // },
    // onConfirm1(value) {
    //   //  console.log(value)
    //   this.value1= value;
    //   this.showPicker1 = false;
    // },
    // onConfirm2(value) {
    //   //  console.log(value)
    //   this.value2 = value;
    //   this.showPicker2 = false;
    // },

  },
};
</script>